package se.id.vrapp;

import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;
import android.widget.SeekBar;
import android.widget.SeekBar.OnSeekBarChangeListener;
import android.widget.TextView;

public class PlannerDialogActivity extends Activity {

	private static int depot;

	public static int[] depotDistances = {46, 81, 107, 138, 177, 207, 230, 260, 277, 300};
	
	@Override
	public void onCreate(Bundle savedInstanceState)  {
		super.onCreate(savedInstanceState);
		this.setContentView(R.layout.planner_helper_dialog);
		
		Intent intent = this.getIntent();
		depot = intent.getIntExtra(PlanRaceFragment.DEPOT_ID, 0);
	//	TextView depotNameTextView = (TextView) findViewById(R.id.planner_dialog_depotname);
		setTitle(PlanRaceFragment.depotNames[depot]+"  "+depotDistances[depot]+" km");
	//	depotNameTextView.setText(PlanRaceFragment.depotNames[depot]);
		final TextView pausetimeTextView = (TextView) findViewById(R.id.planner_dialog_pauseminutes);
		SeekBar minuteControl = (SeekBar) findViewById(R.id.planner_dialog_seekbar);
		pausetimeTextView.setText(""+PlanRaceFragment.pauseTimes[depot]+ " min");
		minuteControl.setProgress(PlanRaceFragment.pauseTimes[depot]);
		
		minuteControl.setOnSeekBarChangeListener(new OnSeekBarChangeListener() {
 
            public void onProgressChanged(SeekBar seekBar, int progress, boolean fromUser){
            	pausetimeTextView.setText(""+seekBar.getProgress()+ " min");
            }
 
            public void onStartTrackingTouch(SeekBar seekBar) {
                // TODO Auto-generated method stub
            }
 
            public void onStopTrackingTouch(SeekBar seekBar) {
            	PlanRaceFragment.pauseTimes[depot] = seekBar.getProgress();
            }
        });
	}
}
